package com.recorder.myapplication.activity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;

/**
 * Created by Administrator on 2019/5/12.
 */

public class KeepReceiver extends BroadcastReceiver {

    private static final String TAG = " KeepReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {

        String action = intent.getAction();

        Log.e(TAG, "OnReceiver:" + action);

        if (TextUtils.equals(action, Intent.ACTION_SCREEN_OFF)) {


            KeepManager.getmInstance().startKeep(context);

        } else if (TextUtils.equals(action, Intent.ACTION_SCREEN_ON)) {
            KeepManager.getmInstance().finishKeep();

        }


    }
}
